package com.eisei.factory.tbl;

import javax.persistence.*;
import java.math.BigInteger;
import java.sql.Timestamp;
import java.util.Collection;

/**
 * Created by equipo.crea on 3/08/14.
 */
@Entity
@Table(name = "TBL_CAT_ESTATUS", schema = "SIS_GES_CALIDAD", catalog = "")
public class TblCatEstatusEntity {
    private BigInteger pkCatEstatus;
    private String descCatEstatus;
    private Timestamp fechaAlta;
    private Timestamp fechaActualiza;
    private Collection<TblCatRolEntity> tblCatRolsByPkCatEstatus;
    private Collection<TblCatRolGruposEntity> tblCatRolGruposesByPkCatEstatus;
    private Collection<TblUsuariosEntity> tblUsuariosesByPkCatEstatus;

    @Id
    @Column(name = "PK_CAT_ESTATUS", nullable = false, insertable = true, updatable = true, length = 1, precision = 0)
    public BigInteger getPkCatEstatus() {
        return pkCatEstatus;
    }

    public void setPkCatEstatus(BigInteger pkCatEstatus) {
        this.pkCatEstatus = pkCatEstatus;
    }

    @Basic
    @Column(name = "DESC_CAT_ESTATUS", nullable = true, insertable = true, updatable = true, length = 50, precision = 0)
    public String getDescCatEstatus() {
        return descCatEstatus;
    }

    public void setDescCatEstatus(String descCatEstatus) {
        this.descCatEstatus = descCatEstatus;
    }

    @Basic
    @Column(name = "FECHA_ALTA", nullable = true, insertable = true, updatable = true, length = 7, precision = 0)
    public Timestamp getFechaAlta() {
        return fechaAlta;
    }

    public void setFechaAlta(Timestamp fechaAlta) {
        this.fechaAlta = fechaAlta;
    }

    @Basic
    @Column(name = "FECHA_ACTUALIZA", nullable = true, insertable = true, updatable = true, length = 7, precision = 0)
    public Timestamp getFechaActualiza() {
        return fechaActualiza;
    }

    public void setFechaActualiza(Timestamp fechaActualiza) {
        this.fechaActualiza = fechaActualiza;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        TblCatEstatusEntity that = (TblCatEstatusEntity) o;

        if (descCatEstatus != null ? !descCatEstatus.equals(that.descCatEstatus) : that.descCatEstatus != null)
            return false;
        if (fechaActualiza != null ? !fechaActualiza.equals(that.fechaActualiza) : that.fechaActualiza != null)
            return false;
        if (fechaAlta != null ? !fechaAlta.equals(that.fechaAlta) : that.fechaAlta != null) return false;
        if (pkCatEstatus != null ? !pkCatEstatus.equals(that.pkCatEstatus) : that.pkCatEstatus != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = pkCatEstatus != null ? pkCatEstatus.hashCode() : 0;
        result = 31 * result + (descCatEstatus != null ? descCatEstatus.hashCode() : 0);
        result = 31 * result + (fechaAlta != null ? fechaAlta.hashCode() : 0);
        result = 31 * result + (fechaActualiza != null ? fechaActualiza.hashCode() : 0);
        return result;
    }

    @OneToMany(mappedBy = "tblCatEstatusByFkCatEstatus")
    public Collection<TblCatRolEntity> getTblCatRolsByPkCatEstatus() {
        return tblCatRolsByPkCatEstatus;
    }

    public void setTblCatRolsByPkCatEstatus(Collection<TblCatRolEntity> tblCatRolsByPkCatEstatus) {
        this.tblCatRolsByPkCatEstatus = tblCatRolsByPkCatEstatus;
    }

    @OneToMany(mappedBy = "tblCatEstatusByFkCatEstatus")
    public Collection<TblCatRolGruposEntity> getTblCatRolGruposesByPkCatEstatus() {
        return tblCatRolGruposesByPkCatEstatus;
    }

    public void setTblCatRolGruposesByPkCatEstatus(Collection<TblCatRolGruposEntity> tblCatRolGruposesByPkCatEstatus) {
        this.tblCatRolGruposesByPkCatEstatus = tblCatRolGruposesByPkCatEstatus;
    }

    @OneToMany(mappedBy = "tblCatEstatusByFkCatEstatus")
    public Collection<TblUsuariosEntity> getTblUsuariosesByPkCatEstatus() {
        return tblUsuariosesByPkCatEstatus;
    }

    public void setTblUsuariosesByPkCatEstatus(Collection<TblUsuariosEntity> tblUsuariosesByPkCatEstatus) {
        this.tblUsuariosesByPkCatEstatus = tblUsuariosesByPkCatEstatus;
    }
}
